package com.neuedu.yyzx.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.neuedu.yyzx.mapper.AdminMapper;
import com.neuedu.yyzx.po.Admin;
import com.neuedu.yyzx.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
public class AdminServiceImpl implements AdminService {
	@Autowired
	private AdminMapper adminMapper;
	@Override
	public Map<String, Object> login(String name, String pass) {
		Map<String,Object> rest = new HashMap<>();
		QueryWrapper<Admin> qw = new QueryWrapper<>();
		qw.eq("name",name);
		qw.eq("pass", pass);
		List<Admin> list = adminMapper.selectList(qw);
		if(list == null || list.size() == 0) {
			rest.put("state","用户名或密码错误");
		}else {
			rest.put("state","success");
		}
		return rest;
	}

}
